﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using xKnight.Attacking.CSRF;
using xKnight.Attacking.EncodedXss;
using xKnight.Attacking.SimpleXss;
using xKnight.Models;

namespace xKnight.Attacking
{
    internal class AttackerFactory
    {
        internal static Attacker CreateAttacker(Attack attack, int _numberOfThreads, Host[] hosts)
        {
            if (attack.AttackType == (int)AttackType.EncodedXss)
            {
                return new EncodedXssAttacker(attack, _numberOfThreads, hosts);
            }

            if (attack.AttackType == (int)AttackType.SimpleXss)
            {
                return new SimpleXssAttacker(attack, _numberOfThreads, hosts);
            }

            if (attack.AttackType == (int)AttackType.CSRF)
            {
                return new CsrfAttacker(attack, _numberOfThreads, hosts);
            }

            throw new InvalidDataException("Invalid Attack Type");
        }

        internal static AttackType[] GetAllAttackTypes()
        {
            AttackType[] attackTypes = new AttackType[]
                                         {
                                             AttackType.SimpleXss, 
                                             AttackType.EncodedXss,
                                             AttackType.CSRF
                                         };

            return attackTypes;
        }
    }
}
